package com.masblearn;

import java.awt.*;

/**
 * 爆炸
 */
public class Explode  extends GameObject{
    public static int Width = ResourceManager.explodes[0].getWidth();
    public static int Heiht = ResourceManager.explodes[0].getHeight();

//    private int x,y;
    private boolean living = true;

    private int step = 0;

    public Explode(int x, int y){
        this.x = x ;
        this.y = y ;
        new Thread(()->{
            new Audio("audio/explode.wav").play();
        }).start();

    }

    public void paint(Graphics g){
        g.drawImage(ResourceManager.explodes[step++],x,y,null);
        if(step>=ResourceManager.explodes.length) GameModel.getInstance().remove(this);
    }

    @Override
    public int getWidth() {
        return Width;
    }

    @Override
    public int getHeight() {
        return Heiht;
    }
}
